package com.leetcode.offer.chapter5;

/**
 * @author Dennis Li
 * @date 2020/7/18 12:04
 */
public class ReverseWords_58 {

    public String reverseWords(String s) {
        String[] strings = s.split("\\s+");
        StringBuilder sb = new StringBuilder();
        for (int i = strings.length - 1; i >= 0; i--) {
            sb.append(strings[i]).append(" ");
        }
        return sb.toString().trim();
    }

}
